﻿/********************************************************************************

** 作者： XmPlatform

** 描述：XmHttpServer

*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
//注解
namespace XmHttpServer.Rest
{
    //[Flags]
    public enum HttpVerb
    {
        Get,
        Post,
        Put,
        Delete
    }
    /// <summary>
    /// 有此属性则将此对象返回字符串
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class Text : System.Attribute
    {
        public const string type = "text";
    }
    /// <summary>
    /// 有此属性则将此对象序列化为xml
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class Xml : System.Attribute
    {
        public const string type = "xml";
    }
    /// <summary>
    /// 有此属性则将此对象序列化为json
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class Json : System.Attribute
    {
        public const string type = "json";
    }


    /// <summary>
    /// 定义一个方法为RestMethod
    /// </summary>
    [AttributeUsage(AttributeTargets.Method)]
    public class RestMethod : System.Attribute
    {
        HttpVerb verb;
        string comment;
        public RestMethod(HttpVerb verb)
        {
            this.verb = verb;
        }
        public RestMethod(HttpVerb verb, string comment)
        {
            this.verb = verb;
            this.comment = comment;
        }
        public HttpVerb Verb
        {
            get { return this.verb; }
            set { this.verb = value; }
        }
        public string Comment
        {
            get { return this.comment; }
            set { this.comment = value; }
        }
    }
}
